package com.tjian.fafa.user.util.Dialog;

import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;

import com.tjian.fafa.user.R;

public class DialogUtil
{
    private static Dialog loadbar = null;

    public static void close()
    {
        if (loadbar != null)
        {
            if (loadbar.isShowing())
            {
                loadbar.dismiss();
            }
        }
    }

    public void initProgressDialog(Context context)
    {
        if (loadbar == null)
        {
            loadbar = new Dialog(context, R.style.load_dialog);
            LayoutInflater mInflater = ((Activity) context).getLayoutInflater();
            View v = mInflater.inflate(R.layout.anim_load, null);
            loadbar.setContentView(v);
            loadbar.setCancelable(true);
            loadbar.show();
        }
        else
        {
            loadbar.show();
        }
    }
}
